<!--begin path way -->
<div class="pathway clearfix">
    <ul>
        <?php foreach ($breadcrumbs as $breadcrumb) { ?>
        <li>
            <a <?php if (isset($breadcrumb['index'])) echo 'class="homepage"'; ?> href="<?php echo $breadcrumb['link']; ?>">
                <?php echo $breadcrumb['title']; ?>
            </a>
        </li>
        <?php } ?>
    </ul>
</div>
<!--end path way -->

<div id="pageCartDetail" class="News-detail">
    <h3>Giỏ hàng</h3>
    <?php if (!empty($cart)) { ?>
    <form action="<?php echo Link::build('cart/update') ?>" method="post">
        <table>
        <thead>
        <tr>
            <th>Ảnh</th>
            <th>Sản phẩm</th>
            <th>Số lượng</th>
            <th>Giá đơn vị</th>
            <th>Tổng giá</th>
            <th></th>
        </tr>
        </thead>
        <tbody>
            <?php foreach ($cart as $item) { ?>
            <tr>
                <td><img src="<?php echo $item['image']; ?>" class="productImage" alt="<?php echo $item['title']; ?>"></td>
                <td><?php echo $item['title']; ?></td>
                <td><input type="text" name="quantity[<?php echo $item['id']; ?>]" value="<?php echo $item['quantity']; ?>" /></td>
                <td><?php echo number_format($item['price']); ?></td>
                <td><?php echo number_format($item['price'] * $item['quantity']); ?></td>
                <td><a href="<?php echo Link::build('cart/delete', $item); ?>" class="button-delete" title="Xóa sản phẩm khỏi giỏ hàng"></a></td>
            </tr>
            <?php } ?>
        </tbody>
        <tfooter>
            <tr>
                <th colspan="4" class="totalPriceColumn">Tổng giá:</th>
                <td><?php echo number_format($totalPrice); ?></td>
            </tr>
        </tfooter>
        </table>

        <div class="submitWrapper">
            <button type="submit" name="do" value="update" class="button">Cập nhật giỏ hàng</button>
            <a href="<?php echo Link::build('checkout') ?>" class="button">Đặt hàng</a>
        </div>
    </form>
    <?php } else { ?>
    <p>Giỏ hàng chưa có sản phẩm nào.</p>
    <?php } ?>
</div>